package com.aceitunaproject.gameclient;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JTextField;

public class LoginFrame extends JFrame implements ActionListener {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	public static void main(String[] args) {
		{
			new LoginFrame();
		}
	}

	JTextField userName;
	JTextField pwd;

	public LoginFrame() {
		super("Aceituna Login");

		java.awt.Container c = this.getContentPane();
		c.setLayout(new BoxLayout(c, BoxLayout.Y_AXIS));
		c.add(new JLabel("User Name"));
		userName = new JTextField("Frodo");
		c.add(userName);
		c.add(new JLabel("Password"));
		pwd = new JTextField();
		c.add(pwd);
		JButton theButton = new JButton("Login");
		theButton.addActionListener(this);
		c.add(theButton);
		setSize(200, 200);
		setExtendedState(NORMAL);
		setVisible(true);
		setDefaultCloseOperation(DISPOSE_ON_CLOSE);
	}

	@Override
	public void actionPerformed(ActionEvent arg0) {
		GameClient.startClient(userName.getText(), pwd.getText());
		this.dispose();


	}
}
